package com.kh.pajx.sop.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.kh.pajx.sop.base.BaseDaoImpl;
import com.kh.pajx.sop.dao.ISchoolRelationDao;
import com.kh.pajx.sop.domain.HsSchoolRelation;

/**
 * 学校扩展关系Dao实现类
 * @author Lipengfei
 *2014/6/24
 */
@Repository
public class SchoolRelationDaoImpl extends BaseDaoImpl<HsSchoolRelation> implements ISchoolRelationDao{

	/**
	 *根据学校编号查询学校关系 
	 */
	@Override
	public HsSchoolRelation getSchoolRelationBySclid(String sclid) {
		// TODO Auto-generated method stub
		String hql="from HsSchoolRelation h where h.sclId='"+sclid+"' and h.relationStatusFlag='1' order by h.createTime desc";
		List hsrelationList=getSession().createQuery(hql).list();
		if(hsrelationList.size()==0){
			return null;
		}else{
			return (HsSchoolRelation)hsrelationList.get(0);
		}
		//return (HsSchoolRelation)getSession().createQuery(hql).list().get(0);
	}

}
